package dexter.core.coord;

import java.util.Properties;

import dexter.testing.EvaluationValues;
import dexter.testing.GenericTest;
import dexter.testing.Logger;

public class ExecutionThread extends Thread {
	
	private GenericTest tester;
	private Properties props;
	private EvaluationValues ev;
	
	public ExecutionThread(GenericTest tester, Properties props) {
	  this.tester = tester;	
	  this.props = props;
	}
	
	public void run() {
		try {
			System.out.println("Execution INIT");
			tester.before(props);
			ev = tester.test();
			tester.after();
		} catch (Exception e) {
			System.out.println("Execution ERROR");
			Logger log = new Logger();
			log.error("REMOTE EXECEPTION : ", e);
			ev = new EvaluationValues(log);
			e.printStackTrace();
		}
		
		System.out.println("Execution END");
	}
	
	public EvaluationValues getResult() {
		return ev;
	}
	

}
